<?php
/**
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 */
	defined ('IN_AGORA') or die;
	
	class TaskController extends AgoraController
	{
		function _execute()
		{
			if (!isset($this->agora_config['o_rss_cron_builtin']) || !isset($this->agora_config['o_rss_cron_interval'])) {
				$config_model = & Model::getInstance('ConfigModel');
				$conf['o_rss_cron_builtin'] = 1;
				$conf['o_rss_cron_interval'] = 3600;
				$conf['o_rss_cron_last'] = time() - 3600;
				Model::getInstance('ConfigModel')->save($conf);
				Agora::redirect(Agora::makeURL());
				return;
			}
				
			if ($this->agora_config['o_rss_cron_builtin'] == '1') {
				Agora::redirect(Agora::makeURL());
				return;
			}
			
			echo "Agora cronjob. Fetching feed urls";
			$feed_model = & Model::getInstance('AggregatorModel');
			$feed_model->runJob();
			die;
		}
		
	}
?>
